package 设计模式.策略模式;

import java.util.HashMap;
import java.util.Map;

/**
 * @author caihe
 * @date 2021/9/24 9:37
 */
public class StrategyFactory {
    
    private static final Map<String, Strategy> strategyMap = new HashMap<>();
    
    static {
        strategyMap.put(StrategyEnums.A.getType(), new StrategyA());
        strategyMap.put(StrategyEnums.B.getType(), new StrategyB());
    }
    
    public static Strategy getStrategy(String type) {
        return strategyMap.get(type);
    }
    
}
